function throttle(fn, delay) {
  var t = null,
    begin = new Date().getTime();
  return function () {
    var _that = this,
      args = arguments,
      cur = new Date().getTime();
    clearTimeout(t);
    if (cur - begin >= delay) {
      fn.apply(_that, args);
      begin = cur;
    } else {
      t = setTimeout(function () {
        fn.apply(_that, args);
      }, delay);
    }
  }
}
export {
  throttle
}